using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AxeForEnemy : GunForEnemy
{
    protected override void Update()
    {
        //mousePos = GameObject.FindWithTag("Player").transform.position;
        if (father.GetComponent<FSM>() != null)
            mousePos = father.GetComponent<FSM>().parameter.target.position;
        if (father.GetComponent<FSM2>() != null)
            mousePos = father.GetComponent<FSM2>().parameter.target.position;
        Shoot();
    }
    /*protected override void Shoot()
    {
        direction = (mousePos - new Vector2(transform.position.x, transform.position.y)).normalized;
        transform.right = direction;

        if (timer != 0)
        {
            timer -= Time.deltaTime;
            if (timer <= 0)
            {
                timer = 0;
            }
        }
        if (anim.GetCurrentAnimatorClipInfo(0)[0].clip.name == "Shoot" && timer == 0)
        {
            fire();
        }
    }*/
    protected override void fire()
    {
        timer = interval;
        anim.SetTrigger("shoot");
        GameObject bullet = ObjectPool.Instance.GetObject(bulletPrefab);
        bullet.transform.localScale = father.transform.localScale;
        bullet.transform.position = transform.position;
        //bullet.transform.right = direction;
    }
}
